home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / man / Lman.ksh < prev    next >
Text File  |  1994-08-05  |  2KB  |  104 lines

  1. # Lman Korn Shell Script (by Ulrich Lauther)
  2. #
  3. # Set Variables 
  4. # "man_dir" to the path name of the LEDA manual directory
  5. # "awk_cmd" to your awk command (must be compatible with GNU gawk)
  6.  
  7.  
  8. #man_dir=/usr/local/leda/man
  9. #awk_cmd=awk
  10. man_dir=/KM/usr/naeher/leda/man
  11. awk_cmd=gawk
  12.  
  13.  
  14. [ ! -d $man_dir ] && {
  15.   print    ""
  16.   print -n "Cannot find LEDA manual directory,"
  17.   print    " change variable 'man_dir' in '$0' \!"
  18.   print    ""
  19.   exit 1
  20. }
  21.  
  22. if [ "$1" = "-l" ]
  23. then
  24.   less=0
  25.   shift
  26. else
  27.   less=1
  28.   if [ "$1" = "-t" ]
  29.   then
  30.     textedit=1
  31.     shift
  32.   else
  33.     textedit=0
  34.   fi
  35. fi
  36.  
  37.  
  38. [ "$1" = "" ] && {
  39. clear
  40. print "Lman - print LEDA manual pages"
  41. print " "
  42. print "Syntax: "
  43. print " "
  44. print "    lman   T   [op]"
  45. print " "
  46. print "Arguments: "
  47. print " "
  48. print "    T   :  name of a LEDA data type"
  49. print " "
  50. print "    op  :  name of an operation of data type T or one of the section names"
  51. print "           definition, declaration, creation, operations, or implementation"
  52. print " "
  53. print "Usage: "
  54. print " "
  55. print "    lman  T        prints the manual page for data type T (piped through less)."
  56. print " "
  57. print "    lman  T  op    prints the manual entry for operation T::op or section"
  58. print "                   op of the manual page for T (if op is a section name)."
  59. print " "
  60. print " "
  61. exit 1
  62. }
  63.  
  64. tex_file=$man_dir/$1.tex
  65. awk_script=$man_dir/AWK
  66.  
  67.  
  68. if [ -f $tex_file ]
  69. then
  70.   if [ "$2" != "" ]
  71.   then
  72.     while [ "$2" != "" ]
  73.     do
  74.       $awk_cmd -f $awk_script $tex_file $2 
  75.       shift
  76.     done
  77.   else
  78.    if [ "$less" = 1 ]
  79.    then
  80.     #$awk_cmd -f $awk_script $tex_file | less -+M -+m -e -n -P"LEDA Manual ($1)"
  81.     $awk_cmd -f $awk_script $tex_file | less -P"<LEDA Manual ($1)>"
  82.    else
  83.     if [ "$textedit" = 1 ]
  84.     then
  85.      $awk_cmd -f $awk_script $tex_file | sed s/_//g > /tmp/lman$$
  86.      textedit -read_only /tmp/lman$$
  87.      rm -f /tmp/lman$$
  88.     else
  89.      $awk_cmd -f $awk_script $tex_file
  90.     fi
  91.    fi
  92.   fi
  93. else
  94.    print "$0": LEDA data type \"$1\" not found
  95.    exit 1
  96. fi
  97.  
  98. exit 0
  99. -- 
  100. ----------------------------------------------------------------------------
  101. Siemens ZFE BT SE 14    Internet: lauther@ztivax.zfe.siemens.de
  102.                         from ems: lauther@ztivax:tcp-636-18:Mch P Siemens AG
  103.  
  104.